<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<form id="dataForm">
    员工姓名: <input type="text" name="username"> <input type="hidden" name="id"> <br>
    员工年龄: <input type="text" name="age"><br/>
    员工密码: <input type="password" name="password"> <br>
    出生日期: <input type="date" name="bornDate"> <br>
    员工邮箱: <input type="email" name="email"> <br>
    员工地址: <input type="text" name="address"> <br>
    <button type="button" id="sub">提交</button> &nbsp; &nbsp; &nbsp;
    <button type="button" id="cancel">取消</button>
</form>
<script src="js/jquery-3.6.0.min.js"></script>
<script type="text/javascript">

    $("#sub").click(function () {
        //获取表单数据
        var data = $("#dataForm").serialize();
        $.post("/person?method=register",data,function (result) {
            if (result == "success"){
                // location.href = "/personList.html";
                // location.href = "/showList.html";
                location.href = "/index.html";
            }else {
                alert("未知错误");
                location.href = "/register.html";
            }
        });
    });
</script>
</body>
</html>